package multithreading.Demo7_Thread8Blocl;

public class Fifth
{

    /**
     *  static 类级别的同步方法与对象级别的同步方法也没有冲突
     *  也无需等待锁的释放
     */
    public static void main(String[] args) {

        Number5 number = new Number5();

        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Number5.getOne();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                number.getTwo();
            }
        }).start();
    }


}

class Number5{
    public static synchronized void getOne() throws InterruptedException {
        Thread.sleep(3000);
        System.out.println("=====one=====");
    }
    public synchronized void getTwo(){
        System.out.println("=====two=====");
    }
}
